# file = open("./file/text.txt","r",encoding="utf-8")
# print(file.readline(),end='')
# print(file.readline(),end='')
# print(file.readline(),end='')


# 第一题
# with open("./file/text.txt","r",encoding="utf-8") as f:
#     a = f.read()
# print(a.count('python'))

# 第二题
# with open("./file/text.txt","r",encoding="utf-8") as f:
#     res=f.read()
# print(res)
# str_list=res.split("\n")
# count=0
# for i in str_list:
#     count+=1
# print(f"总次数{count}")

f=open('./file/fli.txt','r',encoding='utf-8')
str1= f.read()
str2=str1.replace('222','666')
print(str2)
f.close()

fw=open('./file/fli.txt','w',encoding='utf-8')
fw.write(str2)
# write 写的意思
fw.flush()
# flush 确定写入

fr=open('./file/fli.txt','r',encoding='utf-8')
print(fr.read())
fr.close()